package kr.haggenna.sevice.controller;

import kr.haggenna.sevice.dao.ServiceDao;
import kr.haggenna.sevice.domain.ServiceCommand;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
public class ServiceDelelteController {
	
	@Autowired
	private ServiceDao serviceDao;
	
	/*private String formView = "deleteServiceForm";
	
	@RequestMapping("/deleteService.do")
	public ModelAndView form(@RequestParam("service_num")int service_num){
		 ServiceCommand serviceCommand = serviceDao.selectService(service_num);
		 return new ModelAndView(formView,"serviceCommand",serviceCommand);
	}*/
	
	@RequestMapping(value="/deleteService.do",method=RequestMethod.POST)
	public String submit(@ModelAttribute ServiceCommand serviceCommand){
		
		serviceDao.delete(serviceCommand.getService_num());
		
		return "deleteServicePro";
	}
}
